﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Tenth_Assignment {
    public partial class FormCrawler : Form {
        public FormCrawler() {
            InitializeComponent();
        }

        private async void button_Start_Click(object sender, EventArgs e) {
            Crawler crawler = new Crawler();
            if (await crawler.CrawlAsync(textBox_Input.Text, 5)) {
                richTextBox_Output.Clear();
                foreach (string url in crawler.Urls.Keys) {
                    richTextBox_Output.Text += url + "\r\n";
                }
            } else {
                MessageBox.Show("Malformed Url (tips: scheme://server/path/resource)!");
            }
        }

    }
}
